
#pragma once


#include "db/DBRow.h"


struct dpiConn;
struct dpiStmt;

class OCIStmt
{
    OCIStmt(const OCIStmt&);
    void operator=(const OCIStmt&);
public:
    OCIStmt(dpiConn* conn);
    ~OCIStmt();

    bool perpare(const std::string& sql);

    int64_t exec();

    bool query(DBRows& rows);

    //////////////////////////////////////////////////////////////////////////
    bool bind(int index, std::nullptr_t);
    bool bind(int index, bool val);
    bool bind(int index, int8_t val);
    bool bind(int index, int16_t val);
    bool bind(int index, int32_t val);
    bool bind(int index, int64_t val);
    bool bind(int index, uint8_t val);
    bool bind(int index, uint16_t val);
    bool bind(int index, uint32_t val);
    bool bind(int index, uint64_t val);

    bool bind(int index, float val);
    bool bind(int index, double val);

    bool bind(int index, const std::string& val);
    bool bind(int index, const char* val);
    bool bind(int index, const unsigned char* val);

    bool bind(int index, const void* val, size_t len);
private:
    dpiConn     *conn_;
    dpiStmt     *stmt_;
};